﻿using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Rescue_of_the_Dwarvenzombies.SceneObjects;
using Rescue_of_the_Dwarvenzombies.SceneObjects.GameObjects.Obstacles;
using GameLibrary;

namespace Rescue_of_the_Dwarvenzombies.Scene.Levels
{
    /// <summary>
    /// Concrete level "Level1"
    /// </summary>
    /// <remarks></remarks>
    internal class Level1 : Level
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Level"/> class.
        /// </summary>
        /// <remarks></remarks>
        public Level1()
        {
            LevelId = 1;
            _startingPos = new Vector2[4];
            _holes = new List<ISceneObject>();
            _stones = new List<ISceneObject>();
            _walls = new List<ISceneObject>();
            amountOfEnemies = 12;
            InitPlayerStartPos();
            InitSpawnPos();
            initObstacles();
        }



        /// <summary>
        /// Inits the obstacles.
        /// </summary>
        /// <remarks></remarks>
        private void initObstacles()
        {
           //grounds.Add(new Ground(new Vector2(0, 0), Constant.GROUND_WIDTH, Constant.GROUND_HEIGHT, false));
            _ground = new Ground(new Vector2(0, 0), Constant.GROUND_WIDTH, Constant.GROUND_HEIGHT, false);
            //Top wall for level
            _walls.Add(new Wall(new Vector2(0, 0), Constant.GROUND_WIDTH, 30, true));
            //Bottom wall for level
            _walls.Add(new Wall(new Vector2(0, 690), Constant.GROUND_WIDTH, 30, true));
            //Left wall for level
            _walls.Add(new Wall(new Vector2(0, 30), 30, 660, true));
            //Right wall for level
            _walls.Add(new Wall(new Vector2(3970, 30), 30, 660, true));

            //Wall 1
            _walls.Add(new Wall(new Vector2(700, 30), 30, 300, true));
           
            //Wall 2
            _walls.Add(new Wall(new Vector2(900, 330), 200, 200, true));

            //Wall 3
            _walls.Add(new Wall(new Vector2(1300, 500), 30, 190, true));

            //Wall 4
            _walls.Add(new Wall(new Vector2(1500, 300), 30, 30, true));

            //Wall 5
            _walls.Add(new Wall(new Vector2(1500, 150), 30, 30, true));

            //Wall 6
            _walls.Add(new Wall(new Vector2(2000, 300), 250, 30, true));

            //Wall 7
            _walls.Add(new Wall(new Vector2(2200, 400), 30, 200, true));

            //Wall 8
            _walls.Add(new Wall(new Vector2(2500, 300), 30, 30, true));

            //Wall 9
            _walls.Add(new Wall(new Vector2(2500, 500), 30, 30, true));

            //Wall 10
            _walls.Add(new Wall(new Vector2(2600, 300), 30, 30, true));          
        }

        /// <summary>
        /// Inits the player start pos.
        /// </summary>
        /// <remarks></remarks>
        private void InitPlayerStartPos()
        {
            _startingPos[0] = new Vector2(100, 100);
            _startingPos[1] = new Vector2(100, 150);
            _startingPos[2] = new Vector2(150, 100);
            _startingPos[3] = new Vector2(150, 150);
        }

        /// <summary>
        /// Inits the spawn pos.
        /// </summary>
        /// <remarks></remarks>
        private void InitSpawnPos()
        {
            _spawningPos = new Vector2[amountOfEnemies];

            //Spawn point 1
            _holes.Add(new Hole(new Vector2(50, 600), 65, 65, false));

            _spawningPos[0] = new Vector2(150, 600);
            _spawningPos[1] = new Vector2(150, 500);
            _spawningPos[2] = new Vector2(75, 520);
            _spawningPos[3] = new Vector2(100, 500);

            //Spawn point 2
            _holes.Add(new Hole(new Vector2(600, 50), 65, 65, false));

            _spawningPos[4] = new Vector2(550, 50);
            _spawningPos[5] = new Vector2(550, 100);
            _spawningPos[6] = new Vector2(600, 150);

            //Spawn point 3
            _holes.Add(new Hole(new Vector2(1600, 400), 65, 65, false));

            _spawningPos[7] = new Vector2(1700, 490);
            _spawningPos[8] = new Vector2(1700, 580);

            //Spawn point 4
            _holes.Add(new Hole(new Vector2(3000, 400), 65, 65, false));
            _spawningPos[9] = new Vector2(3100, 350);
            _spawningPos[10] = new Vector2(3100, 490);
            _spawningPos[11] = new Vector2(3100, 580);
        }
    }
}